home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7757 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: news.crystalball.com!news
  2. From: Larry Weiss <lfw@oc.com>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: why arrays may seem like pointers
  5. Date: Wed, 28 Feb 1996 12:41:11 -0600
  6. Organization: crystalball.com
  7. Message-ID: <3134A1C7.3FB7@oc.com>
  8. References: <4gsdno$1bg@umbc9.umbc.edu> <4gtab6$acb@ceylon.gte.com> <313318b8.53776146@nntp.ix.netcom.com> <DnHyrp.CF8@eskimo.com>
  9. NNTP-Posting-Host: external.oc.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0 (Win16; I)
  14.  
  15. Steve Summit wrote:
  16.  > 
  17.  > Having learned this, I'm now careful to say things like, "When
  18.  > you make reference to an array in an expression, the compiler
  19.  > automatically generates a pointer to its first element, just as
  20.  > if you'd written &array[0]."  I try to use words like "generate,"
  21.  > and *not* to use words like "convert."
  22.  > 
  23.  
  24. Also, it is common jargon to say the array reference "decays" into
  25. a pointer.    The word "decay" confused me when I first learned the
  26. language, as it conveys that something actually happened to the array.
  27.  
  28. If you are quite naive, and still pondering strange "algebraic"
  29. expressions like  
  30.     x = x + 1 
  31. then it's even more important to get clear explanations of array
  32. semantics.   It's actually "too bad" that one must understand pointers
  33. in order to understand arrays, in general, but then, that's C.
  34.